package com.naiterui.ehp.bs.cms.modules.wms.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.security.annotation.SysLog;
import com.naiterui.ehp.bs.cms.modules.wms.entity.Category;
import com.naiterui.ehp.bs.cms.modules.wms.service.ICategoryService;
import com.naiterui.ehp.bs.cms.modules.wms.vo.CategoryVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@Api(tags = {SwaggerTag.CMS + SwaggerTag.MEDICINE_DRUG})
@RequestMapping("wms/category")
public class CategoryController {

  @Autowired
  private ICategoryService categoryService;

  @SysLog("药理分类")
  @ApiOperation(value = "展示分类")
  @GetMapping("/list")
  @PreAuthorize("@p.check('wms:category:list')")
  public List<Category> list() {
    return this.categoryService.queryList();
  }

  @SysLog("分类列表")
  @ApiOperation(value = "分类列表")
  @GetMapping("/getCategory")
  public List<CategoryVO> getCategory() {
    return this.categoryService.getCategory();
  }
}
